-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix][io] Close the kafka source connector got stuck #20698
[fix][io] Close the kafka source connector got stuck #20698
Conversation
@@ -64,6 +66,7 @@ public abstract class KafkaAbstractSource<V> extends PushSource<V> { | |||
private volatile boolean running = false; | |||
private KafkaSourceConfig kafkaSourceConfig; | |||
private Thread runnerThread; | |||
private final Executor executor = Executors.newSingleThreadExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to set a thread name for debugging purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And when the executor will be closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to set a thread name for debugging purpose.
fixed
And when the executor will be closed?
changed it to a static variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already remove the executor, and just new one thread if needed
pulsar-io/kafka/src/main/java/org/apache/pulsar/io/kafka/KafkaAbstractSource.java
Outdated
Show resolved
Hide resolved
We only use this thread once. Maybe we can new a thread and then run the close task? |
Codecov Report
@@ Coverage Diff @@
## master #20698 +/- ##
============================================
+ Coverage 72.60% 73.17% +0.56%
- Complexity 32018 32105 +87
============================================
Files 1855 1871 +16
Lines 138569 138964 +395
Branches 15250 15283 +33
============================================
+ Hits 100605 101682 +1077
+ Misses 29945 29239 -706
- Partials 8019 8043 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The failed OWASP dependency check will be fixed by #20699 |
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck. Modifications: run `close` in another thread. (cherry picked from commit c5237ea)
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck. Modifications: run `close` in another thread. (cherry picked from commit c5237ea)
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck. Modifications: run `close` in another thread.
Motivation: apache#19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck. Modifications: run `close` in another thread. (cherry picked from commit c5237ea) (cherry picked from commit 3a2e593)
Motivation
#19880 (comment) When Kafka connector is closing, it waits for the
runnerThread
to stop, but the task-close is running at the same thread, so it will be stuck.Modifications
run
close
in another thread.Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x